<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ page import="java.util.*" %>
<%@ page import="org.news.entity.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>新闻管理系统</title>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/swiper.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/css/index.css">
<%
     
     manager mg=(manager) session.getAttribute("user"); 
     Object a1=request.getParameter("quit");
     if("t".equals(a1) ||mg==null){  //点击退出或者未登录状态
    	 session.removeAttribute("user");
    	 //将mg置为空，否则报空指针异常
    	 mg=new manager(null,null,null);
     }
%>

<style type="text/css">
body {
	background: #eee;
	font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
	font-size: 14px;
	color: #000;
	/*css格式化*/	
	margin: 0;
	padding: 0;
}

#banner {
	height: 500px;
	position: relative;
	top:5px;
}

.swiper-container {
	width: 1200px;
	height: 500px;
	/*设置缩小的时候也能居中*/
	margin:0px  auto; 
}

.swiper-slide {
	text-align: center;
	font-size: 18px;
	background: #fff;
	display: -webkit-box;
	display: -ms-flexbox;
	display: -webkit-flex;
	display: flex;
	-webkit-box-pack: center;
	-ms-flex-pack: center;
	-webkit-justify-content: center;
	justify-content: center;
	-webkit-box-align: center;
	-ms-flex-align: center;
	-webkit-align-items: center;
	align-items: center;
}
</style>
<%
    Integer hitsCount = (Integer)application.getAttribute("hitCounter");
    if( hitsCount ==null || hitsCount == 0 ){
       /* 第一次访问 */
       hitsCount = 1;
    }else{
       /* 返回访问值 */   
       hitsCount += 1;
    }
    application.setAttribute("hitCounter", hitsCount); 
    System.out.println("当前访问量为："+""+hitsCount+""+"（重启后失效）");
%>

</head>
<body>
<!-- 导航部分 -->
<div id="nav_div">
	<!-- 页面头部   -->
	<header id="header_div">
	<div class="container">
		<div class="logo left">
			<img src="img/logo2.jpg" width="700" height="90" >
		</div>
		<ul class="right">
		    <li id="info1"><a href="${pageContext.request.contextPath}/view/login/login.jsp">登录</a></li>
			<li id="info2"><a href="${pageContext.request.contextPath}/view/login/addMg.jsp">注册</a></li>
			<li><a href="${pageContext.request.contextPath}/newsServlet/seleByPage/1">查询全部新闻</a></li>
			<li><a href="${pageContext.request.contextPath}/view/News/addNew.jsp">添加新闻</a></li>
			<li><a href="${pageContext.request.contextPath}/upAndDownServlet/allFiles">管理新闻文件</a></li>	
		</ul>
	</div>
	</header> 

</div>
<!-- 轮播图部分 -->
<div id="banner">	
	<div class="swiper-container">
        <div class="swiper-wrapper">
            <div class="swiper-slide"><img src="img/news1.jpg" width="100%;" height="630"></div>
            <div class="swiper-slide"><img src="img/news2.jpg" width="100%;" height="630"></div>
            <div class="swiper-slide"><img src="img/news3.jpg" width="100%;" height="630"></div>
            <div class="swiper-slide"><img src="img/news4.jpg" width="100%;" height="630"></div>
        </div>
        <!-- 箭头部分 -->
        <div class="swiper-pagination"></div>
        <div class="swiper-button-next"></div>
        <div class="swiper-button-prev"></div>
    </div>
    <div class="banner-nav-bg"></div>
</div>   

<!-- 列表 -->   
<div id="ul_div">
  <ul id="ul_one" class="ul_div">
     <h1 align="center">国内新闻</h1>
     <li><a href="">&#8658;印陆军司令：在中印实控线做长期准备</a></li>
     <li><a href="">&#8658;北京昨日新增11病例7例在丰台</a></li>
     <li><a href="">&#8658;华为英国再“落子” 能绕开美国的打压吗？</a></li>
     <li><a href="">&#8658;北京昨日新增11病例7例在丰台</a></li>
     <li><a href="">&#8658;华为英国再“落子” 能绕开美国的打压吗？</a></li>
     <li><a href="">&#8658;北京昨日新增11病例7例在丰台</a></li>
     <li><a href="">&#8658;北京昨日新增11病例7例在丰台</a></li>
     <li><a href="">&#8658;李柱铭受访时公开割席、甩锅 反对派痛骂“快点死”</a></li>
     <li><a href="">&#8658;我驻加拿大使馆就孟晚舟事件发表谈话</a></li>
     <li><a href="">&#8658;这家熟悉的日本百年巨头撑不住了 突然宣布退出</a></li>
     <li><a href="">&#8658;北京新发地农产品批发市场迎来新任总经理</a></li>
     <li><a href="">&#8658;端午假期前两日国内游客达3707.7万人次</a></li>
     <li><a href="">&#8658;北京昨日新增11病例7例在丰台</a></li>
     <li><a href="">&#8658;走出疫情阴霾 武汉以各式活动欢度端午节</a></li>
     <li><a href="">&#8658;北京昨日新增11病例7例在丰台</a></li>
  </ul>
  <ul id="ul_two" class="ul_div">
     <h1 align="center">国际新闻</h1>
     <li><a href="">&#8658;这家熟悉的日本百年巨头撑不住了 突然宣布退出</a></li>
     <li><a href="">&#8658;北京昨日新增11病例7例在丰台</a></li>
     <li><a href="">&#8658;华为英国再“落子” 能绕开美国的打压吗？</a></li>
     <li><a href="">&#8658;北京昨日新增11病例7例在丰台</a></li>
     <li><a href="">&#8658;这家熟悉的日本百年巨头撑不住了 突然宣布退出</a></li>
     <li><a href="">&#8658;这家熟悉的日本百年巨头撑不住了 突然宣布退出</a></li>
     <li><a href="">&#8658;端午假期前两日国内游客达3707.7万人次</a></li>
     <li><a href="">&#8658;北京昨日新增11病例7例在丰台</a></li>
     <li><a href="">&#8658;走出疫情阴霾 武汉以各式活动欢度端午节</a></li>
     <li><a href="">&#8658;北京昨日新增11病例7例在丰台</a></li>
     <li><a href="">&#8658;北京新发地农产品批发市场迎来新任总经理</a></li>
     <li><a href="">&#8658;北京昨日新增11病例7例在丰台</a></li>
     <li><a href="">&#8658;北京昨日新增11病例7例在丰台</a></li>
     <li><a href="">&#8658;华为英国再“落子” 能绕开美国的打压吗？</a></li>
     <li><a href="">&#8658;北京昨日新增11病例7例在丰台</a></li>
  </ul>
<!-- 第三块div -->
<div id="div_three">
     <div>
     <h3 align="center">分类查看</h3><br>
     <table id="table1" class="table">
       <tr>
         <td><a href="${pageContext.request.contextPath}/newsServlet/seleNewsBySort?sort=生活&page=1">生活</a></td>
         <td><a href="${pageContext.request.contextPath}/newsServlet/seleNewsBySort?sort=娱乐&page=1">娱乐</a></td>
         <td><a href="${pageContext.request.contextPath}/newsServlet/seleNewsBySort?sort=军事&page=1">军事</a></td>
       </tr>
       <tr>
          <td><a href="${pageContext.request.contextPath}/newsServlet/seleNewsBySort?sort=政治&page=1">政治</a></td>
          <td><a href="${pageContext.request.contextPath}/newsServlet/seleNewsBySort?sort=国际&page=1">国际</a></td>
          <td><a href="${pageContext.request.contextPath}/newsServlet/seleNewsBySort?sort=社会&page=1">社会</a></td>
       </tr>
     </table>
     </div>
     <br>
     
     <div>
        <h3 align="center">友情链接</h3>
        <table id="table2" class="table">
         <tr>
           <td><img src="img/a1.jpg" width="100" height="60"/></td>
           <td><img src="img/a2.jpg" width="100" height="60"/></td>
           <td><img src="img/a3.jpg" width="100" height="60"/></td>
         </tr>
         <tr>
          <td><img src="img/a4.jpg" width="100" height="60"/></td>
          <td><img src="img/a5.jpg" width="100" height="60"/></td>
          <td><img src="img/a6.jpg" width="100" height="60"/></td>
         </tr>
          <tr>
          <td><img src="img/a7.jpg" width="100" height="60"/></td>
          <td><img src="img/a8.jpg" width="100" height="60"/></td>
          <td><img src="img/a9.jpg" width="100" height="60"/></td>
         </tr>
     </table>
     <p align="right">页面访问量为: <%= hitsCount%></p>
     </div>
</div>
</div>
<!-- 页脚 -->
<div id="footer">
<!--页脚部分-->
	<div class="container">
		<p>
			<img src="img/i-f-logo.png"> <span>@2020 北京市xxxxxxx</span>
			 <a href="#">版权说明</a> <a href="#">版权说明</a> <a href="#">版权说明</a> 
			 <a href="#">版权说明</a> <a href="#">版权说明</a>
		</p>
	</div>
</div>
<!-- js部分 -->
<script type="text/javascript" src="${pageContext.request.contextPath}/js/swiper.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-3.3.1.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/seleAllNews.js"></script>
<script type="text/javascript">
    ///swiper插件效果设置
	var swiper = new Swiper('.swiper-container', {
		pagination : '.swiper-pagination',
		paginationClickable : true,
		loop : true,
		autoplay : 3000,

		speed : 1000,
		prevButton : '.swiper-button-prev',
		nextButton : '.swiper-button-next',
		effect : 'coverflow',//  effect: 'flip',effect: 'coverflow',slide', 'fade',cube 改变bannder的移动效果
		grabCursor : true,
		cube : {
			shadow : false,
			slideShadows : false,
			shadowOffset : 20,
			shadowScale : 0.94
		}
	});
    
    //进行登录判断
	$(function () {
	    var uname="<%=mg.getUname()%>";
	    var uid="<%=mg.getId()%>";
	    //判断用户名是否为空
	    if(!isEmpty(uname)){
	    	$("#info1").html("<span>欢迎您！&nbsp"+uname+"<a href='/NewsManager_SSM/index.jsp?quit=t'> [退出]</a></span>");
	    	$("#info2").text("");
	    }
	});

</script>

</body>
</html>